using UnityEngine;
using UnityEngine.SceneManagement;

public class GameManager : MonoBehaviour
{
	public string UserName = string.Empty;

	public string Team = string.Empty;

	public string UserID = string.Empty;

	public string CharacterKey = string.Empty;

	public int PlayerNetID = -1;

	public int BotNumber = 1;

	public int BotMax = 20;

	public GameView GameViewType;

	[HideInInspector]
	public bool IsRefreshing;

	[HideInInspector]
	public AsyncOperation loadingScene;

	[HideInInspector]
	public bool IsPlaying;

	[HideInInspector]
	public bool IsBattleStart;

	private void Awake()
	{
		Object.DontDestroyOnLoad(base.gameObject);
	}

	public void UpdateProfile()
	{
		PlayerPrefs.SetString("user_name", UserName);
	}

	private void Start()
	{
		UserName = PlayerPrefs.GetString("user_name");
	}

	public void RestartGame()
	{
		if (UnitZ.playerManager != null)
		{
			UnitZ.playerManager.Reset();
		}
	}

	public void QuitGame()
	{
		if (UnitZ.NetworkGameplay != null)
		{
			UnitZ.NetworkGameplay.chatLog.Clear();
		}
		if (UnitZ.playerManager != null)
		{
			UnitZ.playerManager.Reset();
		}
		UnitZ.gameNetwork.Disconnect();
		UnitZ.aiManager.Clear();
	}

	public void StartLoadLevel(string level)
	{
		loadingScene = SceneManager.LoadSceneAsync(level);
	}
}
